package com.ruoyi.common.utils;

import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.lang.reflect.Field;

/**
 * @author zxg
 * @date 2023-11-10
 * @Desc
 */
public class SearchWrapper<T> {

    //public static <T> QueryWrapper<T> getWrapper(T qw){
    //    Field[] f =  ReflectUtil.getFields(qw.getClass());
    //    QueryWrapper<T> queryWrapper = new QueryWrapper<T>();
    //    for(Field field:f){
    //        String methodName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, field.getName());
    //        String sqlField = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, field.getName());
    //        String val = ReflectUtil.invoke(qw,"get"+methodName);
    //        queryWrapper.eq(StrUtil.isNotEmpty(val),sqlField,val);
    //    }
    //    System.out.println(queryWrapper.getSqlSelect());
    //    return queryWrapper;
    //}
}
